%%
%% This is file `tagpdf-debug-generic.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% tagpdf-mc-generic.dtx  (with options: `debug')
%% 
%% Copyright (C) 2019-2025 Ulrike Fischer
%% 
%% It may be distributed and/or modified under the conditions of
%% the LaTeX Project Public License (LPPL), either version 1.3c of
%% this license or (at your option) any later version.  The latest
%% version of this license is in the file:
%% 
%%    https://www.latex-project.org/lppl.txt
%% 
%% This file is part of the "tagpdf bundle" (The Work in LPPL)
%% and all files in that bundle must be distributed together.
%% 
%% File: tagpdf-mc-generic.dtx
\ProvidesExplPackage {tagpdf-debug-generic} {2025-10-31} {0.99w}
 {part of tagpdf - debugging code related to marking chunks - generic mode}
\cs_set_protected:Npn \tag_mc_begin:n #1 %#1 keyval
  {
    \__tag_check_if_active_mc:TF
      {
        \__tag_debug_mc_begin_insert:n { #1 }
        \group_begin: %hm
        \__tag_check_mc_if_nested:
        \bool_gset_true:N \g__tag_in_mc_bool
        \tl_set_eq:NN \l__tag_mc_key_tag_tl \g__tag_struct_tag_tl
        \tl_gset_eq:NN\g__tag_mc_key_tag_tl \g__tag_struct_tag_tl
        \tl_if_empty:NTF\l__tag_mc_lang_tl
          {
            \keys_set:nn { __tag / mc }{ #1 }
          }
          {
            \keys_set:nn { __tag / mc }{ lang=\l__tag_mc_lang_tl, #1 }
          }
        \bool_if:NTF \l__tag_mc_artifact_bool
          { %handle artifact
            \__tag_mc_handle_artifact:N \l__tag_mc_artifact_type_tl
            \exp_args:No
            \__tag_mc_artifact_begin_marks:n { \l__tag_mc_artifact_type_tl }
          }
          { %handle mcid type
            \__tag_check_mc_tag:N  \l__tag_mc_key_tag_tl
            \__tag_mc_handle_mcid:oo
              { \l__tag_mc_key_tag_tl }
              { \l__tag_mc_key_properties_tl }
            \__tag_mc_begin_marks:oo{\l__tag_mc_key_tag_tl}{\l__tag_mc_key_label_tl}
            \tl_if_empty:NF {\l__tag_mc_key_label_tl}
              {
                \__tag_mc_handle_mc_label:e { \l__tag_mc_key_label_tl }
              }
            \bool_if:NF \l__tag_mc_key_stash_bool
              {
                \socket_use:nn{tag/check/parent-child}
                  {
                   \__tag_mc_check_parent_child:o
                    { \g__tag_struct_stack_current_tl }
                  }
                \__tag_mc_handle_stash:e { \int_use:N \c@g__tag_MCID_abs_int }

              }
          }
        \group_end:
      }
      {
        \__tag_debug_mc_begin_ignore:n { #1 }
      }
  }
\cs_set_protected:Nn \tag_mc_end:
  {
    \__tag_check_if_active_mc:TF
      {
        \__tag_debug_mc_end_insert:
        \__tag_check_mc_if_open:
        \bool_gset_false:N \g__tag_in_mc_bool
        \tl_gset:Nn  \g__tag_mc_key_tag_tl { }
        \__tag_mc_emc:
        \__tag_mc_end_marks:
      }
      {
        \__tag_debug_mc_end_ignore:
      }
  }

%% 
%%
%% End of file `tagpdf-debug-generic.sty'.
